Skip to content

Handle empty drive lists during space refresh#150

Open
zerox80 wants to merge 2 commits into
opencloud-eu:mainfrom
zerox80:fix-empty-drive-quota
Open

Handle empty drive lists during space refresh#150
zerox80 wants to merge 2 commits into
opencloud-eu:mainfrom
zerox80:fix-empty-drive-quota

Conversation

@zerox80
Copy link
Copy Markdown
Contributor

@zerox80 zerox80 commented May 9, 2026

Summary

  • handle empty drive list responses without crashing space refresh
  • clear stored spaces for the account when the server returns no spaces
  • keep the DAO safe against accidental empty inserts

Tests

  • Added coverage for empty space refresh responses
  • Added DAO coverage for empty space lists

@zerox80 zerox80 marked this pull request as ready for review May 9, 2026 07:52
@zerox80 zerox80 force-pushed the fix-empty-drive-quota branch from c9b1c73 to ece528d Compare May 9, 2026 08:08
@guruz guruz self-requested a review May 9, 2026 12:25
@zerox80 zerox80 changed the title Handle empty drive quota responses Handle empty drive lists during space refresh May 12, 2026
@guruz
Copy link
Copy Markdown
Contributor

guruz commented May 30, 2026

Did you actually experience this issue?

Copy link
Copy Markdown
Contributor

@guruz guruz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes in DB schema mandate Migration?

@zerox80
Copy link
Copy Markdown
Contributor Author

zerox80 commented Jun 1, 2026

Changes in DB schema mandate Migration?

The DB schema itself does not change here. quota_total is already nullable in the exported Room schema, because the embedded quota object is nullable. This change only aligns the Kotlin model nullability with the existing schema/API behavior, so no migration is required.

I also checked the backend path: the drives endpoint can legitimately return an empty value list, and quota can be serialized as {} when quota information is unavailable, e.g. when the backend quota call is unimplemented/unavailable. The added tests cover both cases.

@zerox80
Copy link
Copy Markdown
Contributor Author

zerox80 commented Jun 1, 2026

Did you actually experience this issue?

Not from a production crash report on my side; I found it while checking edge cases around the drives response. The current code is still reproducibly unsafe for valid backend responses: an empty value list hits first(), and quota: {} hits quota.total!!.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants